package com.nanbei.rabbit.producer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassDescription:
 * @JdkVersion: 1.8
 * @Author: libs
 * @Created: 2024/8/28 16:16
 */
@Configuration
public class RabbitDirectExchangeConfig {
    // 交换机  durable 持久化
    @Bean
    public Exchange directExchange(){
        return ExchangeBuilder.directExchange("direct_exchange").durable(true).build();
    }

    // 队列
    @Bean
    public Queue directQueue01(){
        return QueueBuilder.durable("direct_queue_01").build();
    }

    @Bean
    public Queue directQueue02(){
        return QueueBuilder.durable("direct_queue_02").build();
    }

    // 交换机绑定队列
/*    @Bean
    public Binding directExchangeBindingQueue01(){
        return BindingBuilder.bind(directQueue01()).to(directExchange()).with("info").noargs();
    }

    @Bean
    public Binding directExchangeBindingQueue02BinInfo(){
        return BindingBuilder.bind(directQueue02()).to(directExchange()).with("info").noargs();
    }
    @Bean
    public Binding directExchangeBindingQueue02BinError(){
        return BindingBuilder.bind(directQueue02()).to(directExchange()).with("error").noargs();
    }*/
}
